<template>
	<view>
		<!-- banner -->
		<view class="">
			<swiper :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000">
				<swiper-item v-for="item3 in banner">
					<view class="swiper-item">
						<image :src="item3.src" mode="aspectFill" style="width: 750upx;height: 375upx;"></image>
					</view>
				</swiper-item>
			</swiper>
		</view>
		<!-- 课程分类列表 -->
		<view class=""
			style="display: flex;flex-direction: row;margin: 30upx 10upx 20upx 10upx;flex-wrap: wrap;justify-content: space-around;align-items: center;">
			<view v-for="items in typeList" class="kec1">
				<view class="">
					<image src="../../static/images/q1.png" style="width: 60upx;height: 60upx;"></image>
				</view>
				<view style="font-size: 26upx;">
					{{items.courseName}}
				</view>
			</view>
		</view>
		<!-- 课程列表 -->
		<view style="display: flex;marginflex-direction: row;margin-top: 60upx;">
			<view style="margin-left: 30upx;">
				<image src="../../static/images/kefang.png" style="width: 35upx;height: 35upx;"></image>
			</view>
			<view style="margin-left: 20upx;font-size: 26upx;font-weight: bold;">
				推荐课程
			</view>
		</view>
		<view class="">
			<view v-for="items in courseList" class="zhan">
				<view class="" @click="btnd(items.id)">
					{{items.courseTitle}}
				</view>
				<view class="">
					{{items.createDate}}
				</view>
			</view>
			
		</view>
	</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				typeList: [],
				courseList:[],
				banner: [{
						src: "../../static/images/z1.png"
					},
					{
						src: "../../static/images/z2.png"
					}
				]

			}
		},
		onLoad() {
			this.initData()
		},
		methods: {
			initData() {
				var _this = this
				uni.request({
					url: _this.serverUrl + "renren/coursetype/list",
					success(res) {
					
						_this.typeList = res.data.page.list
					}
				})
				uni.request({
					url: _this.serverUrl + "renren/coursemanager/list",
					success(res) {
						
						_this.courseList = res.data.page.list
					}
				})
			},
			btnd(id) {
				uni.navigateTo({
					url:'./default2?id='+id
				})
			},

		}
	}
</script>

<style>
	.zhan {
		margin: 20upx 40upx 20upx 40upx;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		font-size: 27upx;
		border-bottom: 1upx dashed #555555;
		padding: 10upx;
	}

	.kec1 {
		display: flex;
		flex-direction: column;
		justify-items: center;
		align-items: center;
		border: 1upx solid #555555;
		padding: 10upx;
		border-radius: 16upx;
	}

	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>
